package com.wicket.okrapp.base.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wicket.okrapp.common.dto.FieldInfo;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wicket.okrapp.base.service.MOmsEvaObjTargetCycleCostsetService;
import com.wicket.okrapp.common.exception.BizException;
import com.wicket.okrapp.common.util.CommonFunctionHelper;
import com.wicket.okrapp.dal.mapper.mbg.OmsEvaObjTargetCycleCostsetMapper;
import com.wicket.okrapp.dal.po.mbg.OmsEvaObjTargetCycleCostset;
import com.wicket.okrapp.base.service.dto.req.*;
//import com.wicket.okrapp.base.service.dto.res.*;

import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;

import java.util.*;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author ：
 * @since 2022/1/19 15:39
 *
 *
 * @version 1.0
 */
@Service
public class MOmsEvaObjTargetCycleCostsetServiceImpl
  extends ServiceImpl<OmsEvaObjTargetCycleCostsetMapper, OmsEvaObjTargetCycleCostset>
  implements MOmsEvaObjTargetCycleCostsetService {

  @Autowired
  OmsEvaObjTargetCycleCostsetMapper omsEvaObjTargetCycleCostsetMapper;
/**
   * 3-3-09-04批量查评价对象目标周期预算[2821]
   * gen by moon at 10/15/2022, 10:05:24 PM
   */
 @Trace(operationName = "3-3-09-04批量查评价对象目标周期预算")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsEvaObjTargetCycleCostset>  batchQueryEvaTargetCycleCost(BatchQueryEvaTargetCycleCostReq reqDto) {
     
        try {
            QueryWrapper<OmsEvaObjTargetCycleCostset> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
reqDto.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            if(reqDto.getEvaTargetCycleCostList()==null || reqDto.getEvaTargetCycleCostList().isEmpty()){
                    return new ArrayList<>();
                }
        queryWrapper.in("eva_obj_target_cycle_id", reqDto.getEvaTargetCycleCostList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsEvaObjTargetCycleCostset.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsEvaObjTargetCycleCostset.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsEvaObjTargetCycleCostset.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            
            return ((List<OmsEvaObjTargetCycleCostset>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-04批量查一级部门目标周期预算[2822]
   * gen by moon at 10/15/2022, 10:05:25 PM
   */
 @Trace(operationName = "3-3-09-04批量查一级部门目标周期预算")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsEvaObjTargetCycleCostset>  batchQueryOneDeptTargetCycleCost(BatchQueryOneDeptTargetCycleCostReq reqDto) {
     
        try {
            QueryWrapper<OmsEvaObjTargetCycleCostset> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
reqDto.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            if(reqDto.getOneDeptTargetCycleCostList()==null || reqDto.getOneDeptTargetCycleCostList().isEmpty()){
                    return new ArrayList<>();
                }
        queryWrapper.in("m_level_eva_obj_target_cycle_id", reqDto.getOneDeptTargetCycleCostList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsEvaObjTargetCycleCostset.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsEvaObjTargetCycleCostset.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsEvaObjTargetCycleCostset.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            
            return ((List<OmsEvaObjTargetCycleCostset>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-04批量查询被评对象目标周期预算设置[3251]
   * gen by moon at 10/15/2022, 10:05:26 PM
   */
 @Trace(operationName = "3-3-09-04批量查询被评对象目标周期预算设置")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsEvaObjTargetCycleCostset>  batchQueryEvaObjTargetCycleBudgetSet(BatchQueryEvaObjTargetCycleBudgetSetReq reqDto) {
     
        try {
            QueryWrapper<OmsEvaObjTargetCycleCostset> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
reqDto.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            if(reqDto.getEvaObjTargetCycleBudgetSetList()==null || reqDto.getEvaObjTargetCycleBudgetSetList().isEmpty()){
                    return new ArrayList<>();
                }
        queryWrapper.in("eva_obj_target_cycle_id", reqDto.getEvaObjTargetCycleBudgetSetList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsEvaObjTargetCycleCostset.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsEvaObjTargetCycleCostset.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsEvaObjTargetCycleCostset.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            
            return ((List<OmsEvaObjTargetCycleCostset>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-04批量删被评对象目标周期预算设置[3259]
   * gen by moon at 10/15/2022, 10:05:27 PM
   */
 @Trace(operationName = "3-3-09-04批量删被评对象目标周期预算设置")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  boolean  batchDeleteEvaObjTargetCycleBudgetSet(List<String> reqDto) {
     
          if(reqDto==null || reqDto.size()==0){
            return false;
          }
          
          return super.removeByIds(reqDto);
  }
/**
   * 3-3-09-04查询被评对象目标周期预算设置列表[3677]
   * gen by moon at 10/15/2022, 10:05:27 PM
   */
 @Trace(operationName = "3-3-09-04查询被评对象目标周期预算设置列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsEvaObjTargetCycleCostset>  queryEvaObjTargetCycleBudgetSetList(QueryEvaObjTargetCycleBudgetSetListReq reqDto) {
     
        try {
            QueryWrapper<OmsEvaObjTargetCycleCostset> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsEvaObjTargetCycleCostset.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsEvaObjTargetCycleCostset.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsEvaObjTargetCycleCostset.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            
            return ((List<OmsEvaObjTargetCycleCostset>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-04批量改被评对象目标周期预算设置[3678]
   * gen by moon at 10/15/2022, 10:05:28 PM
   */
 @Trace(operationName = "3-3-09-04批量改被评对象目标周期预算设置")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  boolean  batchUpdateEvaObjTargetCycleBudgetSet(List<OmsEvaObjTargetCycleCostset> omsEvaObjTargetCycleCostset) {
     
      if(omsEvaObjTargetCycleCostset==null || omsEvaObjTargetCycleCostset.size()==0){
        return false;
      }
        return super.saveOrUpdateBatch(omsEvaObjTargetCycleCostset);
      
  }
/**
   * M3-3-09-04一键删除被评对象目标周期预算设置测试验证数据[4434]
   * gen by moon at 10/15/2022, 10:05:29 PM
   */
 @Trace(operationName = "M3-3-09-04一键删除被评对象目标周期预算设置测试验证数据")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  boolean  autoDeleteTargetCycleCostsetTest(List<String> reqDto) {
     
          if(reqDto==null || reqDto.size()==0){
            return false;
          }
          
          return super.removeByIds(reqDto);
  }
/**
   * M3-3-09-04查询被评对象目标周期预算设置测试列表[4462]
   * gen by moon at 10/15/2022, 10:05:30 PM
   */
 @Trace(operationName = "M3-3-09-04查询被评对象目标周期预算设置测试列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsEvaObjTargetCycleCostset>  queryTargetCycleCostsetTestList(QueryTargetCycleCostsetTestListReq reqDto) {
     
        try {
            QueryWrapper<OmsEvaObjTargetCycleCostset> queryWrapper = new QueryWrapper<>();
            
            
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsEvaObjTargetCycleCostset.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsEvaObjTargetCycleCostset.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsEvaObjTargetCycleCostset.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            
            return ((List<OmsEvaObjTargetCycleCostset>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }

}

